<!-- user表单弹窗 -->
<form id="user-form" lay-filter="user-form" class="layui-form model-form">
    <input name="csrftoken" type="hidden" value="${csrftoken!}">
    <div class="layui-form-item">
        <label class="layui-form-label">APP名称</label>
        <div class="layui-input-block">
            <input name="appName" placeholder="请输入APP名称" type="text" class="layui-input" lay-verify="required" autocomplete="off"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">AppId</label>
        <div class="layui-input-block">
            <input name="appId" placeholder="请输入AppId" type="text" class="layui-input" lay-verify="required" autocomplete="off"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">AppKey</label>
        <div class="layui-input-block">
            <input name="appKey" placeholder="请输入AppKey" type="text" class="layui-input" lay-verify="required" autocomplete="off"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">SecretKey</label>
        <div class="layui-input-block">
            <input name="secretKey" placeholder="请输入SecretKey" type="text" class="layui-input" lay-verify="required" autocomplete="off"/>
        </div>
    </div>
    <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
            layer.load(2);
            admin.req('${rc.contextPath}/baiduApp/save', data.field, function (data) {
                layer.closeAll('loading');
                if (data.code == 200) {
                    layer.msg(data.message, {icon: 1});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.message, {icon: 2});
                }
            }, "POST");
            return false;
        });
    });
</script>